package hello

import (
	"context"

	v1 "demo/api/hello/v1"
	"demo/internal/dao"
	"demo/internal/model/do"
)

func (c *ControllerV1) UserCreate(ctx context.Context, req *v1.UserCreateReq) (res *v1.UserCreateRes, err error) {
	// return nil, gerror.NewCode(gcode.CodeNotImplemented)
	uid, err := dao.User.Ctx(ctx).Data(do.User{
		Name:   req.Name,
		Age:    req.Age,
		Status: v1.StatusOK,
	}).InsertAndGetId()
	if err != nil {
		return nil, err
	}
	return &v1.UserCreateRes{
		Id: uid,
	}, nil
}
